package com.atguigu.guli.service.base.exception;

import com.atguigu.guli.service.base.result.ResultCodeEnum;
import lombok.Data;
import org.springframework.cglib.core.CodeEmitter;

//以后使用时需要new
@Data
public class GuliException  extends RuntimeException{
    // exception.getMessage()
    private ResultCodeEnum codeEnum;
    private Exception e;
    public GuliException(ResultCodeEnum codeEnum){//codeEnum为了接受方便给用户提示的异常信息
        super(codeEnum.getMessage());
        this.codeEnum = codeEnum;
    }
    //  e 为了方便后端打印异常的堆栈信息
    public GuliException(ResultCodeEnum codeEnum , Exception e){//codeEnum为了接受方便给用户提示的异常信息
        super(e.getMessage());
        this.codeEnum = codeEnum;
        this.e = e;
    }
}
